package com.example.a2032.activity

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.amap.api.fence.GeoFence
import com.bumptech.glide.Glide
import com.example.a2032.R
import com.example.a2032.Utils.Utils
import kotlinx.android.synthetic.main.activity_geo_fence_show.*

class GeoFenceShowActivity : BaseActivity() {
    companion object{

        const val key_Type: String = "key_Type"
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_geo_fence_show)
        Utils.wakeUpAndUnlock(this)
        Utils.startVibrato(this, 500)
        val type = intent.getIntExtra(key_Type, GeoFence.STATUS_IN)
        showIcon(type)
    }

    fun showIcon(type: Int) {
        var id = when (type) {
            GeoFence.STATUS_IN -> R.drawable.genfence_in
            else -> R.drawable.genfence_out
        };
        var text = when (type) {
            GeoFence.STATUS_IN -> getString(R.string.inSafeZone)
            else -> getString(R.string.OutSafeZone)
        };
        textView_genFence.text = text;
        Glide.with(this).asGif().load(id).into(imageView_genFence)
    }
}